﻿<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:tx="http://www.springframework.net/tx"
         xmlns:db="http://www.springframework.net/database"
         xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/schema/objects/spring-objects.xsd 
                             http://www.springframework.net/schema/tx http://www.springframework.net/schema/tx/spring-tx-1.1.xsd
                             http://www.springframework.net/schema/db http://www.springframework.net/schema/db/spring-database.xsd">


	<!--  ============================================================================================================================================= -->
	<!--  *******************************************************  MessageQueue Process ************************************************************** -->
	<!--  ============================================================================================================================================= -->

	<!--Syncroprocessor Delegate to plain .NET object for message handling-->
	<object id="SyncroMessageListenerAdapter" type="Spring.Messaging.Listener.MessageListenerAdapter, Spring.Messaging">
		<property name="HandlerObject" ref="SyncroHandler"/>
		<property name="DefaultHandlerMethod" value="Handler"/>
		<property name="MessageConverterObjectName" value="xmlMessageConverter"/>
	</object>

	<!--Message Listener Container-->
	<object id="SyncroMessageListenerContainer" type="Spring.Messaging.Listener.TransactionalMessageListenerContainer, Spring.Messaging">
		<property name="MessageQueueObjectName" value="SyncroInputTxQueue"/>
		<property name="PlatformTransactionManager" ref="MessageQueueTransactionManager"/>
		<property name="MessageListener" ref="SyncroMessageListenerAdapter"/>
		<property name="MessageTransactionExceptionHandler" ref="ExceptionHandler"/>
		<property name="RecoveryTimeSpan" value="${SyncroHost.RecoveryTimeSpan}"/>
		<property name="MaxConcurrentListeners" value="${SyncroHost.MaxConcurrentListeners}"/>
	</object>

	<!--InputQueue Factory-->
	<object id="SyncroInputTxQueue" type="Spring.Messaging.Support.MessageQueueFactoryObject, Spring.Messaging">
		<property name="Path" value="${SyncroHost.InputQueue.Path}"/>
		<property name="MessageReadPropertyFilterSetAll" value="true"/>
	</object>

	<!--MSMQ Transaction Manager-->
	<object id="MessageQueueTransactionManager" type="Spring.Messaging.Core.MessageQueueTransactionManager, Spring.Messaging" singleton="false"/>

	<!-- My Message XmlMessage Converter to Serialize Messages in MSMQ -->
	<object id="xmlMessageConverter" type="Spring.Messaging.Support.Converters.XmlMessageConverter, Spring.Messaging" singleton="false">
		<property name="TargetTypes">
			<list>
				<value>VisitorMessageType</value>
			</list>
		</property>
	</object>

	<object id="ExceptionHandler" type="Spring.Messaging.Listener.SendToQueueExceptionHandler, Spring.Messaging">
		<property name="MaxRetry" value="5"/>
		<property name="MessageQueueObjectName" value="DefaultErrorTxQueue"/>
	</object>

	<object id="DefaultErrorTxQueue" type="Spring.Messaging.Support.MessageQueueFactoryObject, Spring.Messaging">
		<property name="Path" value="${SyncroHost.ErrorQueue.Path}"/>
		<property name="MessageReadPropertyFilterSetAll" value="true"/>
	</object>

</objects>
